home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Demos / OOFILE / Buildable, limited OOFILE / OOFILE partial source / oof2.cpp < prev    next >
Encoding:
Text File  |  1995-09-25  |  15.2 KB  |  754 lines  |  [TEXT/CWIE]

  1. // COPYRIGHT 1994 A.D. Software, All rights reserved
  2.  
  3. // backend parent layer of OOFILE database
  4.  
  5. #include "oof2.hpp"
  6.  
  7. // static variables
  8. dbRelChain* OOF_mixRelChainEndPoint::sTransitoryRelChainLinks;
  9. char OOF_String::sEmptyStr = '\0';
  10.  
  11.  
  12. // -------------------------------------------------------
  13. //           O O F _ t a b l e  B a c k e n d 
  14. // -------------------------------------------------------
  15. OOF_tableBackend::OOF_tableBackend(const OOF_tableBackend& rhs, const OOF_Dictionary& tablesFields) :
  16.                                     mFields(tablesFields),
  17.                                     mTableName(rhs.mTableName),
  18.                            mDirty(false)
  19. {
  20. //    mTableName = rhs.mTableName;
  21.     mOIDfield = rhs.mOIDfield;  // NOT YET IMPLEMENTED - fix this, it shouldn't be copied!
  22. }
  23.  
  24. // PUT BACK INLINE LATER
  25. void OOF_tableBackend::setOIDfield(const dbField &oidfield)
  26. {
  27.     mOIDfield = (dbField *) &oidfield; // should use const_cast as not changing
  28. }
  29.  
  30.  
  31. // PUT BACK INLINE LATER
  32. bool OOF_tableBackend::isDirty() const
  33. {
  34.         return mDirty;
  35. }
  36.  
  37.  
  38.  
  39.     
  40.  
  41. // -------------------------------------------------------
  42. //  O O F _ E x p a n d a b l e L o n g A r r a y
  43. // -------------------------------------------------------
  44. OOF_ExpandableLongArray::OOF_ExpandableLongArray(unsigned long defaultValue, unsigned long numSlots, unsigned int expandBySlots) :
  45.                                 mBits(0),
  46.                                 mDefaultValue(defaultValue),
  47.                                 mNextFreeEntry(0),
  48.                                 mNumSlots(0),
  49.                                 mExpansionChunk(expandBySlots)
  50. {
  51.     if (mExpansionChunk<1)
  52.         mExpansionChunk = 1;
  53.     if (numSlots) 
  54.     {
  55.         mNumSlots = ((numSlots-1) / expandBySlots + 1) * expandBySlots;
  56.         mBits = new unsigned long[mNumSlots];
  57.     }
  58.     CreateArrayRefCount();
  59. }
  60.  
  61.  
  62. OOF_ExpandableLongArray::OOF_ExpandableLongArray(const OOF_ExpandableLongArray& rhs) 
  63. {
  64.     mBits = rhs.mBits;
  65.     mDefaultValue = rhs.mDefaultValue;
  66.     mNextFreeEntry = rhs.mNextFreeEntry;    
  67.     mNumSlots = rhs.mNumSlots;
  68.     mInternalIter = 0;
  69.     mExpansionChunk = rhs.mExpansionChunk;
  70.     mArrayRefCount = rhs.mArrayRefCount;
  71. // inc storage refs
  72.     *mArrayRefCount += 1;
  73. }
  74.  
  75.  
  76. OOF_ExpandableLongArray& OOF_ExpandableLongArray::operator=(const OOF_ExpandableLongArray& rhs) 
  77. {
  78.     if ((this == &rhs) || (mBits == rhs.mBits))
  79.         return *this;
  80.     
  81.     DeleteBits();
  82.     mBits = rhs.mBits;
  83.     mDefaultValue = rhs.mDefaultValue;
  84.     mNextFreeEntry = rhs.mNextFreeEntry;    
  85.     mNumSlots = rhs.mNumSlots;
  86.     mInternalIter = 0;
  87.     mExpansionChunk = rhs.mExpansionChunk;
  88.     mArrayRefCount = rhs.mArrayRefCount;
  89. // inc storage refs
  90.     *mArrayRefCount += 1;
  91.     return *this;
  92. }
  93.  
  94.  
  95. void OOF_ExpandableLongArray::copyContents(const OOF_ExpandableLongArray& rhs)
  96. {
  97. #ifdef OOF_SmartHeap
  98.     MemPoolCheck(MemDefaultPool);
  99. #endif
  100.     DeleteBits();
  101.     mNumSlots=rhs.mNumSlots;  
  102.     mBits = new unsigned long[mNumSlots];
  103.     assert(mBits);
  104.     memcpy(mBits, rhs.mBits, sizeof(mBits));
  105. #ifdef OOF_SmartHeap
  106.     MemPoolCheck(MemDefaultPool);
  107. #endif
  108.     CreateArrayRefCount();
  109. }
  110.  
  111.  
  112. OOF_ExpandableLongArray::~OOF_ExpandableLongArray() 
  113. {
  114.     DeleteBits();
  115. }
  116.  
  117.  
  118. void OOF_ExpandableLongArray::DeleteBits() 
  119. {
  120.     *mArrayRefCount-=1;
  121.     if (!*mArrayRefCount) {
  122.             delete[] mBits;
  123.             delete mArrayRefCount;
  124.     }
  125. }
  126.  
  127.  
  128. void OOF_ExpandableLongArray::CreateArrayRefCount()
  129. {
  130.     mArrayRefCount = new int;
  131.     assert(mArrayRefCount);
  132.     *mArrayRefCount = 1;
  133. }
  134.  
  135.  
  136. void OOF_ExpandableLongArray::append(unsigned long aBit)  {
  137.     operator[](mNextFreeEntry) = aBit;
  138.     mNextFreeEntry++;
  139. }
  140.  
  141.  
  142. void OOF_ExpandableLongArray::deleteCell(unsigned long index)  {
  143. #ifdef OOF_SmartHeap
  144.     MemPoolCheck(MemDefaultPool);
  145. #endif
  146.     for (unsigned long i=index; i<mNextFreeEntry; i++)
  147.         mBits[i] = mBits[i+1];
  148. #ifdef OOF_SmartHeap
  149.     MemPoolCheck(MemDefaultPool);
  150. #endif
  151.     mNextFreeEntry--;
  152.     mBits[mNextFreeEntry] = mDefaultValue;
  153. }
  154.  
  155.  
  156. void OOF_ExpandableLongArray::deleteAllCells()  {
  157.     mNextFreeEntry=0;
  158. // NOT YET IMPLEMENTED - delete mBits if past threshold
  159. }
  160.  
  161.  
  162. unsigned long& OOF_ExpandableLongArray::operator[](unsigned long index)
  163. {
  164. #ifdef OOF_SmartHeap
  165.     MemPoolCheck(MemDefaultPool);
  166. #endif
  167.     if (index >= mNumSlots)
  168.         ExpandToInclude(index);
  169.     return mBits[index];
  170. }
  171.  
  172.  
  173. unsigned long OOF_ExpandableLongArray::value(unsigned long index) const
  174. {
  175.     assert (index < mNumSlots);
  176.     return mBits[index];
  177. }
  178.  
  179.  
  180. void OOF_ExpandableLongArray::ExpandToInclude(unsigned long indexToCover)
  181. {
  182. // expand the storage to include the specified index
  183. // (ie: expand to the next chunk multiple >= indexToCover
  184.     unsigned int newSize = (indexToCover / mExpansionChunk + 1) * mExpansionChunk;
  185.     unsigned long *oldBits = mBits;
  186.     mBits = new unsigned long[newSize];
  187. // NOT YET IMPLEMENTED - need error handling here
  188.  
  189.     assert(mBits);
  190.     if (oldBits) {
  191.         for (unsigned long i=0; i<mNextFreeEntry; i++)
  192.             mBits[i] = oldBits[i];
  193.         delete[] oldBits;
  194.     }
  195. #ifdef OOF_SmartHeap
  196.     MemPoolCheck(MemDefaultPool);
  197. #endif
  198.     for (unsigned long i=mNextFreeEntry; i<newSize; i++)
  199.         mBits[i] = mDefaultValue;
  200.     mNumSlots = newSize;
  201. #ifdef OOF_SmartHeap
  202.     MemPoolCheck(MemDefaultPool);
  203. #endif
  204. }
  205.  
  206.  
  207.  
  208. // -------------------------------------------------------
  209. //                 O O F _ D i c t r e p
  210. // -------------------------------------------------------
  211. void OOF_DictRep::Append(OOF_bitPointer aBit)  {
  212.     operator[](mNextFreeEntry) = aBit;
  213.     mNextFreeEntry++;
  214. }
  215.  
  216.  
  217. void OOF_DictRep::Reset()  
  218. {
  219.     mNextFreeEntry=0;
  220.  
  221.  
  222. OOF_DictRep::OOF_DictRep(unsigned int numSlots, unsigned int expandBySlots) : 
  223.                                 mBits(0),
  224.                                 mExpansionChunk(expandBySlots),
  225.                                 mNextFreeEntry(0),
  226.                                 mNumSlots(0)
  227. {
  228.     if (mExpansionChunk<1)
  229.         mExpansionChunk = 1;
  230.     if (numSlots) 
  231.     {
  232.         mNumSlots = ((numSlots-1) / expandBySlots + 1) * expandBySlots;
  233.         mBits = new OOF_bitPointer[mNumSlots];
  234.         assert(mBits);
  235.     }
  236. }
  237.  
  238.  
  239. OOF_DictRep::OOF_DictRep(const OOF_DictRep* rhs) : 
  240.                                 mBits(0),
  241.                                 mExpansionChunk(rhs->mExpansionChunk),
  242.                                 mNextFreeEntry(rhs->mNextFreeEntry),
  243.                                 mNumSlots(rhs->mNumSlots)
  244. {
  245.     if (mNumSlots) 
  246.     {
  247.         mBits = new OOF_bitPointer[mNumSlots];
  248.         assert(mBits);
  249.         for (unsigned long i=0; i<mNumSlots; i++)
  250.             mBits[i] = rhs->mBits[i];
  251. #ifdef OOF_SmartHeap
  252.     MemPoolCheck(MemDefaultPool);
  253. #endif
  254.     }
  255. }
  256.  
  257.  
  258. OOF_DictRep::~OOF_DictRep() 
  259. {
  260.     if (mNumSlots)
  261.         delete[] mBits;
  262. }
  263.  
  264.  
  265. OOF_bitPointer& OOF_DictRep::operator[](unsigned int index)
  266. {
  267. #ifdef OOF_SmartHeap
  268.     MemPoolCheck(MemDefaultPool);
  269. #endif
  270. #ifdef OOF_Debug
  271.     if (index > mNumSlots) {
  272.         cout << "OOF_DictRep::operator[] skipped a cell - suspect index" << endl;
  273.         assert(0);
  274.     }    
  275. #endif
  276.     if (index >= mNumSlots)
  277.         ExpandToInclude(index);
  278.     return mBits[index];
  279. }
  280.  
  281.  
  282. OOF_bitPointer& OOF_DictRep::operator[](const char *name)
  283. {
  284.     return mBits[0];  // NOT YET IMPLEMENTED
  285. }
  286.  
  287.  
  288. OOF_bitPointer OOF_DictRep::value(unsigned int index) const
  289.     assert(index < mNumSlots);
  290.     return mBits[index];
  291. }
  292.  
  293.  
  294.  
  295.  
  296. void OOF_DictRep::ExpandToInclude(unsigned int indexToCover) 
  297. {
  298.     unsigned int newSize = (indexToCover / mExpansionChunk + 1) * mExpansionChunk;
  299.     OOF_bitPointer *oldBits = mBits;
  300.     mBits = new OOF_bitPointer[newSize];
  301. // NOT YET IMPLEMENTED - need error handling here
  302.  
  303.     assert(mBits);
  304. #ifdef OOF_SmartHeap
  305.     MemPoolCheck(MemDefaultPool);
  306. #endif
  307.     if (oldBits) {
  308.         for (unsigned long i=0; i<mNextFreeEntry; i++)
  309.             mBits[i] = oldBits[i];
  310.         delete[] oldBits;
  311.     }
  312. #ifdef OOF_SmartHeap
  313.     MemPoolCheck(MemDefaultPool);
  314. #endif
  315.     for (unsigned long i=mNextFreeEntry; i<newSize; i++)
  316.         mBits[i] = 0;
  317. #ifdef OOF_SmartHeap
  318.     MemPoolCheck(MemDefaultPool);
  319. #endif
  320.     mNumSlots = newSize;
  321. }
  322.  
  323.  
  324.  
  325. // -------------------------------------------------------
  326. //               O O F _ D i c t i o n a r y
  327. // -------------------------------------------------------
  328. OOF_Dictionary::OOF_Dictionary() : 
  329.                                                             mOwnsContents(false)
  330. {
  331.     mRep = new OOF_DictRep(0, kDefExpansionChunk);
  332. }
  333.  
  334.  
  335. OOF_Dictionary::OOF_Dictionary(const OOF_DictRep* rep) : 
  336.                                                             mOwnsContents(false)
  337. {
  338.     mRep = new OOF_DictRep(rep);
  339. }
  340.  
  341.  
  342. OOF_Dictionary::OOF_Dictionary(unsigned int numSlots) : 
  343.                                                             mOwnsContents(false)
  344.     mRep = new OOF_DictRep(numSlots, kDefExpansionChunk);
  345. }
  346.  
  347.  
  348. OOF_Dictionary::OOF_Dictionary(unsigned int numSlots, unsigned int expansionChunk) : 
  349.                                                             mOwnsContents(false)
  350. {
  351.     mRep = new OOF_DictRep(numSlots, expansionChunk);
  352. }
  353.  
  354.  
  355. OOF_Dictionary::OOF_Dictionary(const OOF_Dictionary& rhs)
  356. {
  357.     mRep = rhs.mRep;
  358.     mOwnsContents = rhs.mOwnsContents;
  359.     mRep->mReferences++;
  360. }
  361.  
  362.  
  363.  
  364. OOF_Dictionary::~OOF_Dictionary() 
  365. {
  366.     if (--mRep->mReferences<=0) {
  367.         if (mOwnsContents)
  368.             deleteAll();
  369.         delete mRep;
  370.     }
  371. }
  372.  
  373.  
  374. OOF_Dictionary& OOF_Dictionary::operator=(const OOF_Dictionary& rhs)
  375. {
  376.     if ((this == &rhs) || (mRep == rhs.mRep))
  377.         return *this;
  378.     
  379.     if (--mRep->mReferences<=0)
  380.         delete mRep;
  381.  
  382.     mRep = rhs.mRep;
  383.     mRep->mReferences++;
  384.     return *this;
  385. }
  386.  
  387.  
  388. OOF_Dictionary OOF_Dictionary::clone() const
  389. {
  390.     OOF_Dictionary ret(mRep);  
  391.     return ret;
  392. }
  393.  
  394.  
  395. unsigned int OOF_Dictionary::countVisible(bool wantVisible) 
  396. {
  397.     unsigned int ret=0;
  398.    unsigned int theCount = count();
  399.     for (unsigned int i=0; i<theCount; i++) {
  400.         dbClass* entry = mRep->operator[](i);
  401.         assert(entry);  // looping known entries!
  402.         if (EntryMatchesVisibility(entry, wantVisible))
  403.             ret++;
  404.     }
  405.     return ret;
  406. }
  407.  
  408.  
  409. bool OOF_Dictionary::moreVisible(bool wantVisible) 
  410. {
  411.     if (!more())
  412.         return false;
  413.     dbClass* entry=0;
  414.     while (more()) {
  415.         dbClass* entry = operator()();
  416.         assert(entry);  // looping known entries!
  417.         if (EntryMatchesVisibility(entry, wantVisible))
  418.             return true;
  419.         next();
  420.     }
  421.     return (EntryMatchesVisibility(entry, wantVisible));
  422. }
  423.  
  424.  
  425. void OOF_Dictionary::deleteAll()
  426. {
  427.   unsigned int numEntries = count();
  428.     for (unsigned int i=0; i<numEntries; i++) {
  429.         delete &item(i);
  430.         next();
  431.     }
  432. }
  433.  
  434.  
  435. void OOF_Dictionary::describe(ostream& os)
  436. {
  437.    unsigned int numEntries = count();
  438.     for (unsigned int i=0; i<numEntries; i++) {
  439.         (operator[](i))->describe(os);
  440.         next();
  441.     }
  442.     os << endl;
  443. }
  444.  
  445.  
  446. void OOF_Dictionary::describeVisible(ostream& os, bool wantVisible)
  447. {
  448.     startVisible(wantVisible);
  449.     while (moreVisible(wantVisible)) {    
  450.         (operator()())->describe(os);
  451.         nextVisible(wantVisible);
  452.     }
  453.     os << endl;
  454. }
  455.  
  456.  
  457. bool OOF_Dictionary::allObjectsMatch(OOF_Dictionary& rhs)
  458. {
  459.     if (mRep==rhs.mRep)
  460.         return true;  // trivial case of comparing aliases
  461.         
  462.     if (count() != rhs.count())
  463.         return false;
  464.     
  465.    unsigned int numEntries = count();
  466.     for (unsigned int i=0; i<numEntries; i++)
  467.         if (operator[](i) != rhs.operator[](i))
  468.             return false;
  469.             
  470.     return true;
  471. }
  472.  
  473.  
  474. // PUT BACK INLINE LATER
  475. OOF_bitPointer& OOF_Dictionary::operator[](const char *name)
  476. {
  477.     return mRep->operator[](name);
  478. }
  479.  
  480. // PUT BACK INLINE LATER
  481. OOF_bitPointer& OOF_Dictionary::operator[](unsigned int index)
  482. {
  483.     return mRep->operator[](index);
  484. }
  485.  
  486.  
  487. // -------------------------------------------------------
  488. //              O O F _ S t r i n g
  489. // -------------------------------------------------------
  490. OOF_String::OOF_String(const OOF_String& rhs)
  491. {
  492.     mLen = rhs.mLen;
  493.     if (mLen) {
  494.         mBody = new char[mLen + 1];  // room for null
  495.         assert(mBody);
  496.         strcpy(mBody, rhs.mBody);
  497. #ifdef OOF_SmartHeap
  498.         MemPoolCheck(MemDefaultPool);
  499. #endif
  500.     }
  501.     else
  502.         mBody=0;
  503. }
  504.  
  505.  
  506. OOF_String::OOF_String(const OOF_String& str1, const char *chars, const OOF_String& str3)
  507. {
  508.     unsigned int charLen = 0;
  509.     if (chars) 
  510.         charLen = strlen(chars);
  511.     mLen = str1.mLen + charLen + str3.mLen;
  512.     if (mLen==0)
  513.         mBody = 0;
  514.     else {
  515.         mBody = new char[mLen + 1];  // room for null
  516.         assert(mBody);
  517.         if (str1.mBody)
  518.             strcpy(mBody, str1.mBody);
  519.         else
  520.             mBody[0]='\0';
  521. #ifdef OOF_SmartHeap
  522.         MemPoolCheck(MemDefaultPool);
  523. #endif
  524.         if (charLen)
  525.             strcat(mBody, chars);
  526.         if (str3.mBody)
  527.             strcat(mBody, str3.mBody);
  528. #ifdef OOF_SmartHeap
  529.         MemPoolCheck(MemDefaultPool);
  530. #endif
  531.     }
  532. }
  533.  
  534.  
  535. OOF_String::OOF_String(const OOF_String& str1, const char *chars)
  536. {
  537.     unsigned int charLen = 0;
  538.     if (chars) 
  539.         charLen = strlen(chars);
  540.     mLen = str1.mLen + charLen;
  541.     if (mLen==0)
  542.         mBody = 0;
  543.     else {
  544.         mBody = new char[mLen + 1];  // room for null
  545.         assert(mBody);
  546.         if (str1.mBody)
  547.             strcpy(mBody, str1.mBody);
  548.         else
  549.             mBody[0]='\0';
  550. #ifdef OOF_SmartHeap
  551.         MemPoolCheck(MemDefaultPool);
  552. #endif
  553.         if (charLen)
  554.             strcat(mBody, chars);
  555. #ifdef OOF_SmartHeap
  556.         MemPoolCheck(MemDefaultPool);
  557. #endif
  558.     }
  559. }
  560.  
  561.  
  562. OOF_String::OOF_String(const OOF_String& str1, const char ch, const char *chars)
  563. {
  564.     const unsigned int len1 = str1.mLen;
  565.     unsigned int charLen = 0;
  566.     if (chars) 
  567.         charLen = strlen(chars);
  568.     mLen = len1 + charLen + 1;
  569.  
  570.     mBody = new char[mLen + 1];  // room for null
  571.     assert(mBody);
  572.     if (str1.mBody)
  573.         strcpy(mBody, str1.mBody);
  574.     else
  575.     mBody[len1]=ch;
  576.     mBody[len1+1]='\0';
  577. #ifdef OOF_SmartHeap
  578.     MemPoolCheck(MemDefaultPool);
  579. #endif
  580.     if (charLen)
  581.         strcat(mBody, chars);
  582. #ifdef OOF_SmartHeap
  583.     MemPoolCheck(MemDefaultPool);
  584. #endif
  585. }
  586.  
  587.  
  588. OOF_String::OOF_String(const char *chars)
  589. {
  590.     mLen = 0;
  591.     mBody = 0;
  592.     if (chars) {
  593.         mLen = strlen(chars);
  594.         if (mLen) {
  595.             mBody = new char[mLen + 1];  // room for null
  596.             assert(mBody);
  597.             strcpy(mBody, chars); 
  598.     #ifdef OOF_SmartHeap
  599.         MemPoolCheck(MemDefaultPool);
  600.     #endif
  601.         }
  602.     }
  603. }
  604.  
  605.  
  606. OOF_String::~OOF_String()
  607. {
  608.     delete [] mBody;
  609. }
  610.  
  611.  
  612. OOF_String& OOF_String::operator=(const OOF_String& rhs)
  613. {
  614.     if (*this==rhs)
  615.         return *this;
  616.         
  617.     delete[] mBody;
  618.     mLen = rhs.mLen;
  619.     if (mLen==0)
  620.         mBody = 0;
  621.     else {
  622.         mBody = new char[mLen + 1];  // room for null
  623.         assert(mBody);
  624.         strcpy(mBody, rhs.mBody);
  625. #ifdef OOF_SmartHeap
  626.         MemPoolCheck(MemDefaultPool);
  627. #endif
  628.     }
  629.     return *this;
  630. }
  631.  
  632.  
  633. OOF_String& OOF_String::operator=(const char* chars)
  634. {
  635.     delete[] mBody;
  636.     if (chars) {
  637.         mLen = strlen(chars);
  638.         mBody = new char[mLen + 1];  // room for null
  639.         assert(mBody);
  640.         strcpy(mBody, chars); 
  641. #ifdef OOF_SmartHeap
  642.     MemPoolCheck(MemDefaultPool);
  643. #endif
  644.     }
  645.     else {
  646.         mLen = 0;
  647.         mBody = 0;
  648.     }
  649.     return *this;
  650. }
  651.  
  652.  
  653. OOF_String::operator char *() const
  654. {        
  655. // WARNING this code exposes the internal container
  656. // but is safe so long as this is a read-only cast.
  657. //    char *ret;
  658.     if (mBody)
  659.         return mBody;
  660.     else
  661.         return &sEmptyStr;
  662. }
  663.  
  664.  
  665. char *OOF_String::adopt()
  666. {        
  667.     char *ret=mBody;
  668.     mBody = 0;
  669.     mLen = 0;
  670.     return ret;
  671. }
  672.  
  673.  
  674. ostream& operator<<(ostream& os, const OOF_String& str)
  675. {
  676.     os << (char*) str;
  677.     return os;
  678. }
  679.  
  680.  
  681. #ifdef _Macintosh
  682. // -------------------------------------------------------
  683. //              O O F _ M a c S t r i n g
  684. // -------------------------------------------------------
  685. OOF_MacString::OOF_MacString(const Str63 str)
  686. {
  687.     mLen = str[0];
  688.     mBody = 0;
  689.     if (mLen) {
  690.             mBody = new char[mLen + 1];  // room for null
  691.             assert(mBody);
  692.             memcpy(mBody, &(str[1]), mLen);
  693.             mBody[mLen] = '\0';
  694.     #ifdef OOF_SmartHeap
  695.         MemPoolCheck(MemDefaultPool);
  696.     #endif
  697.     }
  698. }
  699. #endif
  700.  
  701. // -------------------------------------------------------
  702. //          O O F _ I n d e x O p t i o n s
  703. // -------------------------------------------------------
  704. ostream& operator<<(ostream& os, OOF_IndexOptions opt)
  705. {
  706.     switch (opt) {
  707.     case (kNotIndexed) :
  708.         os << "not indexed";
  709.         break;
  710.         
  711.     case (kIndexed) :
  712.         os << "indexed, allowing dups & ignoring case";
  713.         break;
  714.         
  715.     case (kIndexNoDups) :
  716.         os << "indexed, no dups & ignoring case";
  717.         break;
  718.         
  719.     case (kIndexCaseSensitive) :
  720.         os << "indexed, allowing dups but case-sensitive";
  721.         break;
  722.         
  723.     case (kIndexCompressPaddingNoDups) :
  724.         os << "indexed, no dups & ignoring case, compressing padding";
  725.         break;
  726.         
  727.     case (kIndexCompressLeadingNoDups) :
  728.         os << "indexed, no dups & ignoring case, compressing front";
  729.         break;
  730.         
  731.     case (kIndexCompressNoDups) :
  732.         os << "indexed, no dups & ignoring case, compress front & padding";
  733.         break;
  734.         
  735.     case (kIndexCompress) :
  736.         os << "indexed, ignoring case, compress front & padding";
  737.         break;
  738.         
  739.     case (kIndexCompressPadding) :
  740.         os << "indexed, ignoring case, compressing padding";
  741.         break;
  742.         
  743.     case (kIndexCompressLeading) :
  744.         os << "indexed, ignoring case, compressing front";
  745.         break;
  746.         
  747.     }
  748.     return os;
  749. }
  750.  
  751.